package com.chinadrtv.batch.admin.jobs.ozing.gift;

/**
 * User: Jack.Chen
 * Date: 12-12-19
 */

import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.launch.JobLauncher;

import java.util.Date;
import java.util.logging.Logger;

/**
 * 定时调度类
 * <p/>
 * User: Jack.Chen
 * Date: 12-12-20
 */

public class QuartzOzingCardJob {

    private static final Logger logger = Logger.getLogger(QuartzOzingCardJob.class.getName());

    private JobLauncher jobLauncher;

    private Job ozingCardJob;

    private JobParametersBuilder jobParameterBulider;

    /**
     * 执行业务方法
     *
     * @throws Exception
     */
    public void execute() throws Exception {
        jobParameterBulider.addDate("date", new Date());
        jobLauncher.run(ozingCardJob, jobParameterBulider.toJobParameters());
    }

    public void setJobLauncher(JobLauncher jobLauncher) {
        this.jobLauncher = jobLauncher;
    }

    public void setOzingCardJob(Job ozingCardJob) {
        this.ozingCardJob = ozingCardJob;
    }

    public void setJobParameterBulider(JobParametersBuilder jobParameterBulider) {
        this.jobParameterBulider = jobParameterBulider;
    }
}

